  <?php 
  $repository=BO::getProductBORepository();
  $id=getFormValue('id');
  $productBO = $repository->getProductBO($id);	?>
<div class="panel panel-default">
  <!-- Default panel contents -->
  <div class="panel-heading">Product : <?php echo $productBO->getName() ?></div>
  <div class="panel-body">
		<p>
		
		</p>	

	  	
		<ul class="nav nav-tabs" role="tablist">
		  <li><a href="dispatch.php?target=product-edit&id=<?php echo $productBO->getID() ?>">General</a></li>
		  <li><a href="dispatch.php?target=product_attribute-edit&id=<?php echo $productBO->getID() ?>">Attributes</a></li>
		  <li class="active"><a href="dispatch.php?target=product_images-edit&id=<?php echo $productBO->getID() ?>">Images</a></li>
		  <li><a href="dispatch.php?target=product_pricing-edit&id=<?php echo $productBO->getID() ?>">Pricing</a></li>
		  <li><a href="dispatch.php?target=product_categories-edit&id=<?php echo $productBO->getID() ?>">Categories</a></li>
		  <li><a href="dispatch.php?target=product_variations-edit&id=<?php echo $productBO->getID() ?>">Variations</a></li>
		</ul>
		<div class="panel">	
			<div class="panel-body">
				<div class="bs-example">
					<h1>Product : Images</h1>
					<form class="form-horizontal" action="upload.php" method="post" enctype="multipart/form-data">
						<input type="hidden" name="target" value="product_images-save">
						<input type="hidden" name="id" value="<?php echo $productBO->getID() ?>">
						<input type="hidden" name="MAX_FILE_SIZE" value="10485760"/>
						<div class="form-group">
							<label class="col-xs-1" for="inputview">Image View:</label>
							<div class="col-xs-2">
								<select name="imageview">
									<option value="Default">Default</option>
									<option value="Alternate">Alternate</option>
									<option value="Front">Front</option>
									<option value="Back">Back</option>
									<option value="Side">Side</option>
									<option value="UP">UP</option>
									<option value="Down">Down</option>
								</select>
							</div>
							
							<label class="col-xs-1" for="inputview">Image Type:</label>
							<div class="col-xs-2">
								<select name="imagetype">
									<option value="L">L</option>
									<option value="M">M</option>
									<option value="S">S</option>
									<option value="1XL">1XL</option>
									<option value="1XS">1XS</option>
									<option value="2XS">2XS</option>
									<option value="3XL">3XL</option>
									
								</select>
							</div>
							<label class="col-xs-1" for="inputfile">File:</label>
							<div class="col-xs-3">
								<input type="file" name="file"   id="inputfile">
							</div>
							<div class="col-xs-2">
								<input type="submit" class="btn btn-primary" value="Submit">
							</div>
						</div>
					</form>
				</div>
			</div>
			
			<div class="table-responsive">
				<table class="table table-striped">
				  <thead>
					<tr>
					  <th>ImageView</th>
					  <th>ImageType</th>
					  <th>Path</th>
					  <th>Action</th>
					</tr>
				  </thead>
				  <tbody>
					<?php 
						$productImages = $productBO->getImages(); 
						foreach($productImages as $k => $productImage)
						{
					?>
					<tr>
					  <td><?php echo $productImage->imageview;?></td>
					  <td><?php echo $productImage->imagetype;?></td>
					  <td><a href="<?php echo $productImage->imagepath;?>" target="_blank"><?php echo $productImage->imagepath;?></a></td>
					  <td>
						<div class="btn-group">						 
							<a href="<?php echo $productImage->imagepath;?>" target="_blank" class="btn btn-default"><span class="glyphicon glyphicon-picture"></span></a>						  
							<a href="dispatch.php?target=product_images-delete&id=<?php echo $productBO->getID()?>&imageid=<?php echo $productImage->id?>"  class="btn btn-default"><span class="glyphicon glyphicon-trash"></span></a>						  
						</div>
					  </td>	
					</tr>
					<?php	
						}
					?>
				  </tbody>
				</table>
		</div>
			
			
		</div>
		
	</div>
	
	 <div class="panel-footer">
		<div class="btn-group">
			<form action="dispatch.php" method="post">
				<button type="submit" name="target" value="product-add" class="btn btn-default btn-lg">
					<span class="glyphicon glyphicon-plus"></span> New Product
				</button>
			</form>
		</div>
	</div>	
</div>	
		  
		  
		  
